package cn.common.tool;

import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import cn.common.dao.BaseDao;


public class seal_list extends BaseDao	 //����list�������ҷ���
{
	public ArrayList seal_list1(int page_now , int page_sum , ResultSet rs) throws SQLException		//��ݷ�ҳ��Ϣ��ѯlist
	{
		ArrayList<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
		if (rs != null) 
		{
			
			for(int i =0 ; i<(page_now-1)*4 ; i++)
			{
				rs.next();
			}
			
			ResultSetMetaData rsmd = rs.getMetaData();
			int iNumOfCol = rsmd.getColumnCount();			//��ȡ����
			int j = 0;
			
			while(rs!=null && rs.next() && j<4)
			{
				HashMap<String,Object> map = new HashMap<String,Object>();
				for(int p = 1 ; p<=iNumOfCol ; p++)
				{
					map.put(rsmd.getColumnName(p), rs.getObject(p));
				}
				
				list.add(map);
				j++;
			}
		}
		return list;		
	}
	
	
	
	public ArrayList seal_list2(ResultSet rs) throws SQLException	//��rsȫ����װ��list
	{
		ArrayList<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
		ResultSetMetaData rsmd = rs.getMetaData();
		int iNumOfCol = rsmd.getColumnCount();			//��ȡ����
				
		while(rs!=null && rs.next() )
		{
			HashMap<String,Object> map = new HashMap<String,Object>();
			for(int p = 1 ; p<=iNumOfCol ; p++)
			{
				map.put(rsmd.getColumnName(p), rs.getObject(p));
			}
			
			list.add(map);
		}
		//System.out.println(iNumOfCol);
		return list;	
		
	}
	//传入当前页面，每页显示的数据量 ，结果集，  返回的arraylist以user类型输出

	
	
}
